<template>
	<view>
		<view class="cu-form-group margin-top">
			<view class="title">联系人</view>
			<input placeholder="收货人姓名" name="input"></input>
		</view>
		<view class="cu-form-group">
			<view class="title">手机号</view>
			<input placeholder="收货人手机号" name="input"></input>
		</view>
		<view class="cu-form-group" @click="biaozu">
			<view class="title">地址</view>
			<input :placeholder="address" name="input" disabled></input>
			<text class='cuIcon-locationfill text-orange'></text>
		</view>
		<view class="cu-form-group">
			<view class="title">门牌号</view>
			<input placeholder="楼号,门派" name="input"></input>
		</view>
		<view class="bbtn padding">
			<view class=" flex flex-direction  bbtn_10">
				<button class="cu-btn bg-yellow text-white round lg" >提交</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				address:'在地图选择'
			};
		},
		methods:{
			//选择位置
			biaozu() {
				const that = this
				// uni.showLoading({
				// 	title: '加载中',
				// 	mask: true
				// });
			
				//#ifdef MP-WEIXIN 
				uni.getSetting({
					success(res) {
						if (!res.authSetting['scope.userLocation']) {
							uni.authorize({
								scope: 'scope.userLocation',
								success() {
									that.chooseLocation()
									return;
								}
							})
						} else {
							that.chooseLocation()
							return;
						}
					}
				})
				//#endif
			
				//#ifndef MP-WEIXIN 
				that.chooseLocation()
				//#endif
			},
			chooseLocation() {
				const that = this
				uni.chooseLocation({
					success: function(res) {
						console.log('address:', res)
						that.address = res.name
						that.list.position = res
					}
				});
			},
		}
	}
</script>

<style lang="scss">
.bbtn{position: fixed;bottom: 0;width: 100%;z-index: 9;}
</style>
